{% extends 'layout/base.html' %}

{% block content %}
<div class="row mt-5">
    <div class="col-lg-3"></div>
    <div class="col-lg">
        <h3 class="mb-0">
            <div class="row">
                <div class="col-lg">
                    {{ zone.domain }}
                </div>
                <div class="col-lg-3 text-right">
                    <a class="btn btn-sm btn-primary" title="edit zone" href="{{ url_for('dns.zone_edit', dns_zone_id=zone.id) }}"><i class="fas fa-edit fa-fw"></i> edit</a>

                    {% if zone.master == False %}
                    <form action="{{ url_for('dns.zone_delete', dns_zone_id=zone.id) }}" method="post" class="d-inline ml-1" id="delete-zone-form-{{ zone.id }}">
                        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
                        <a href="#" class="confirm-delete btn btn-sm btn-danger" title="delete zone"><i class="fas fa-trash fa-fw"></i> delete</a>
                    </form>
                    {% endif %}
                </div>
            </div>
        </h3>

        <div class="row mt-2">
            <div class="col" title="tags">
                {% for tag in zone.tags %}
                <span class="badge badge-info">{{ tag }}</span>
                {% endfor %}
            </div>
            <div class="col">
                <div class="clearfix">
                    <div class="float-right text-nowrap">
                        {% set class = 'success' if zone.active else 'warning' %}
                        {% set text = 'enabled' if zone.active else 'disabled' %}
                        <span class="badge badge-pill badge-{{ class }}">status: {{ text }}</span>

                        {% if zone.regex == False %}
                            {% set text = 'catch-all' if zone.catch_all else 'exact' %}
                            <span class="badge badge-pill badge-primary">matching: {{ text }}</span>
                        {% endif %}

                        {% set class = 'success' if zone.forwarding else 'warning' %}
                        {% set text = 'enabled' if zone.forwarding else 'disabled' %}
                        <span class="badge badge-pill badge-{{ class }}">forwarding: {{ text }}</span>

                        {% if zone.regex %}
                        <span class="badge badge-pill badge-primary">regex</span>
                        {% endif %}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="row mt-3">
    <div class="col-lg-3">
        {% include 'dns/includes/sidebar.html' %}
    </div>
    <div class="col-lg">
        {% if section == 'records' %}
            {% include 'dns/records/view.html' %}
        {% elif section == 'records_edit' %}
            {% include 'dns/records/edit.html' %}
        {% elif section == 'notifications' %}
            {% include 'dns/notifications/view.html' %}
        {% elif section == 'email_settings' %}
            {% include 'dns/notifications/settings/email.html' %}
        {% elif section == 'slack_settings' %}
            {% include 'dns/notifications/settings/slack.html' %}
        {% elif section == 'teams_settings' %}
            {% include 'dns/notifications/settings/teams.html' %}
        {% elif section == 'restrictions' %}
            {% include 'dns/restrictions/view.html' %}
        {% elif section == 'restrictions_edit' %}
            {% include 'dns/restrictions/edit.html' %}
        {% elif section == 'conditions_edit' %}
            {% include 'dns/conditions/edit.html' %}
        {% endif %}
    </div>
</div>
{% endblock %}